/*
	Header file
	-----------
	Queue.h

	Description:
	------------
	Template declaration for Queue data structure
	Includes all method, attributes and relevent properties

 */

#ifndef _QUEUE_H_
#define _QUEUE_H_

#include "DL_List.h"

template <class T, int size>
class Queue
{
public:
    Queue(): maxSize(size) {};		    // default constructor
    ~Queue() { myQueue.Clear(); };		// destructor
    void Enqueue(const T &item) {		// implements PushFront of DL_List<T>
	    // Queue full ?
	    if (myQueue.Size() == maxSize)
		    return;

	    myQueue.PushFront(item);
    };
	bool Empty() { return (myQueue.Size() == 0); };					// returns true - queue is empty, false otherwise
	int Size() { return myQueue.Size(); };	                        // Returns the size of the queue
    T* Peek() {						                                // Peeks into last element
        return ((this->myQueue.Size() == 0) ? NULL : myQueue.Back());
    };
	void Dequeue(int n=1);				                            // pops n items from queue

private:
	DL_List<T> myQueue;
	int maxSize;
};

template <class T, int size>
void Queue<T,size>::Dequeue(int n=1)
{
	// Remove n elements
	for ( ; (n>0) && (myQueue.Size() > 0); n--)
		myQueue.PopBack();
}




#endif